unit BW_Global;

{$mode objfpc}{$H+}

interface

uses
  LW_Server;

type
  TGlobFuncUseMode     = (umTransient, umAquire, umRelease);
  TGlobFuncInitUseMode = umTransient..umAquire;

  TGlobalClass = class of TGlobal;

  { TGlobal }

  TGlobal = class abstract
  protected
    FGlobal      : Pointer;
    FInitUseMode : TGlobFuncInitUseMode;

    // Child classes must override this and return their global type
    function  GetGlobalType                         : String; virtual; abstract;

  public
    constructor
              Create
              (      Global      : TGlobalFunc         ;
                     InitUseMode : TGlobFuncInitUseMode) ;
    destructor
              Destroy                               ;
  end;

implementation

{ TGlobal }

constructor
          TGlobal.Create
                  (      Global      : TGlobalFunc         ;
		         InitUseMode : TGlobFuncInitUseMode) ;
begin
  FGlobal      := Global(PChar(GetGlobalType), Integer(InitUseMode));
  FInitUseMode := InitUseMode ;
end;

destructor
          TGlobal.Destroy                                    ;
begin
end;

end.
